package rle2d;

import java.awt.image.BufferedImage;

public class ImageEncoder {
	private BufferedImage image = null;
	
	public ImageEncoder(BufferedImage image){
		this.image = image;
	}
	
	public void encode (){
		for (int y=0; y<image.getWidth(); y++){
			for (int x=0; x<image.getHeight(); x++){
				int pixel = image.getRGB(x, y);
				System.out.println("w"+x+"h"+y+" "+Integer.toHexString(pixel));
			}
		}
	}
	
	private int[] findRectangle (int x, int y){
		int[] RU = new int [] {x, y};
		
		int color = image.getRGB(x, y);
		int highest = 1;
		while (image.getRGB(x+highest, y)==color){
			highest ++;
		}
		int widthest = 1;
		while (image.getRGB(x, y+widthest)==color){
			widthest++;
		}
		if (highest == 1 && widthest == 1){
			return RU;
		}
		
		return RU;
	}
}
